<script src="<?php echo base_url();?>js/admin.js?<?php echo time(); ?>" type="text/javascript"></script>
<script type="text/javascript">
  var awaiting_html = '<?php echo $this->lang->line('admin_status_0'); ?>';
  var approved_html = '<?php echo $this->lang->line('admin_status_1'); ?>';
  var rejected_html = '<?php echo $this->lang->line('admin_status_2'); ?>';
</script>
<link rel="stylesheet" type="text/css" href="<?php echo base_url();?>css/admin.css?<?php echo time(); ?>" media="screen" />
<div id="admin-index">
  <div id="pager-section"><?php echo $pager_html; ?></div>
  <table>
    <tr>
    <?php foreach ($fields as $field) : ?>
    <th><?php echo $field ?></th>
    <?php endforeach; ?>
    <th>Approve</th><th>Reject</th>
    </tr>
  <?php foreach ($avatars->result_array() as $avatar) : ?>
  <tr id="avatar-<?php echo $avatar['id']; ?>-row">
    <?php foreach ($fields as $field) : ?>
    <?php if($field == 'filename') : ?>
    <td>
      <a class="avatar-single-link" href="<?php echo base_url() . 'gallery/single/' . $avatar['id'] ?>">
       <img style="width:60px; height: 50px" src="<?php echo base_url() . '/uploads/t_' . $avatar['filename']; ?>" />
     </a>
    <?php elseif ($field == 'status') : ?>
    <td class="status-field"><?php echo $this->lang->line('admin_status_' . $avatar['status']); ?></td>
    <?php elseif ($field == 'timestamp') : ?>
    <td><?php echo date('d.M H:i:s', $avatar[$field])?></td>
    <?php else : ?>
    <td><?php echo $avatar[$field]; ?></td>
    <?php endif; ?>
    <?php endforeach; ?>
    <td><div class="approve-button" style="<?php if ($avatar['status'] == 1) : ?>display:none<?php endif;?>" rel="<?php echo $avatar['id']; ?>">Approve</div></td>
    <td><div class="reject-button" style="<?php if ($avatar['status'] == 2) : ?>display:none<?php endif;?>" rel="<?php echo $avatar['id']; ?>">Reject</div></td>
  </tr>
  <?php endforeach; ?>
  </table>
  <div id="pager-section"><?php echo $pager_html; ?></div>
</div>